package model;


/**
 * Describes local user using <i>singleton pattern</i>.
 * 
 * <p>
 * <ul>
 * <li>Project: 	ChatSystemG3</li>
 * </ul>
 * </p>
 * 
 * @author COMBES Nicolas - LECHANTRE Arnaud
 */
public class LocalUser extends User {

	/**
	 * Static instance
	 */
	private static LocalUser instance;
	
	/**
	 * Private constructor
	 * @param name
	 */
	private LocalUser(String name) {
		super(name);
	}
	
	/**
	 * getInstance;  either creates an instance using private constructor and returns it, or simply returns it.
	 * @param name
	 * @return
	 */
	public static LocalUser getInstance(String name){
		if(LocalUser.instance==null){
			return new LocalUser(name);
		}else {
			instance.setName(name);
			return instance;
		}
	}

	
}
